package exceptions; 
 // : exceptions/ExceptionMethods.java
// Demonstrating the Exception Methods.
import static net.mindview.util.Print.*;

public class ExceptionMethods {
    public static void main(String[] args) {
        try {
            throw new Exception("My Exception");
        } catch (Exception e) {
            print("Caught Exception");
            print("getMessage():" + e.getMessage());
            print("getLocalizedMessage():" + e.getLocalizedMessage());
            print("toString():" + e);
            print("printStackTrace():");
            e.printStackTrace(System.out);
        }
    }
} /*
   * Output:
   * Caught Exception
   * getMessage():My Exception
   * getLocalizedMessage():My Exception
   * toString():java.lang.Exception: My Exception
   * printStackTrace():
   * java.lang.Exception: My Exception
   * at ExceptionMethods.main(ExceptionMethods.java:8)
   */// :~
